<script setup>
import {ref, inject} from "vue";
import adminCommunal from "@/components/communal/admin-communal.vue";
import {post_upClass} from "@/res/api/admin_api.js";
const locale = ref("语言1");

const up_class = ref({
  classTitle:null,
  classNode:null,
  classType:null,
  classContent:null,
  classSource:null,
  classImage:null,
  createTime: new Date(),
  isFinish : null,
  userId:null
})


function newCourseClick() {
  $message.destroyAll()
  $message.info("创建成功")
}
function setCourseClick() {
  $message.destroyAll()
  $message.warning("点击测试")
}
post_upClass({

})
</script>

<template>
  <admin-communal nav="courses-add">
    <n-card>
      <n-h3>请输入课程相关信息</n-h3>
      <n-divider/>
      <n-form>
      <n-grid x-gap="12" cols="3">
        <n-gi>
          <n-form-item label="课程标题">
            <n-input type="text" v-model:value="up_class.classTitle" placeholder="请设置课程名称"/>
          </n-form-item>
          <n-form-item   label="封面设置">
            <n-space vertical>
              <n-upload
                  action="https://www.mocky.io/v2/5e4bafc63100007100d8b70f"
                  max="1"
                  list-type="image-card"
              >
                点击上传
              </n-upload>
              <n-text depth="3">只允许上传jpg文件，文件大小不允许超过5Mb</n-text>
            </n-space>
          </n-form-item>
          <n-form-item label="课程状态">
            <n-radio-group v-model:value="up_class.isFinish">
              <n-space>
                <n-radio label="已完成" value="up" />
                <n-radio label="未完成" value="down" />
              </n-space>
            </n-radio-group>
          </n-form-item>
          <n-form-item label="课程简介">
            <n-input type="textarea" clearable show-count maxlength="200" placeholder="课程简介"/>
          </n-form-item>
        </n-gi>
        <n-gi>
          <n-form-item label="上传人员工号">
            <n-input type="text" v-model:value="up_class.userId" placeholder="上传人员工号"/>
          </n-form-item>
          <n-form-item label="课程章节及内容">
            <n-input type="textarea" v-model:value="up_class.classContent" clearable show-count maxlength="1000" placeholder="课程章节及内容"/>
          </n-form-item>
          <n-form-item label="课程类型">
            <n-input type="text" v-model:value="up_class.classType" placeholder="课程相关语言"/>
          </n-form-item>
        </n-gi>
      </n-grid>
      </n-form>
      <n-space justify="space-evenly">
        <n-button type="info" @click="newCourseClick">确认创建</n-button>
        <n-button type="info" @click="setCourseClick">编辑</n-button>
      </n-space>
    </n-card>
  </admin-communal>
</template>

<style scoped>

</style>